<?php
global $base_url;
$counter = 0;
$hiddenid = "";
?>
<script>
$(document).ready(function() {
    $(".hideMe").hide();
    $(".seemore a").click(function() {
        $linktext = $(this).text();
        if($linktext == 'See More'){
            $(this).text('See Less');
        }
        else{
            $(this).text('See More');
        }
        $(".hideMe").toggle();
    });
});
</script>
<section id="category_<?php echo $data['tid'] ?>" class="products_showcase left">
    <div class="product_showcase_heading">
        <h2><?php echo $data['tname'] ?></h2>
    </div> 
    <ul>
        <?php foreach ($data['nodes'] as $model) : ?>
            <li class=<?php echo $hiddenid; ?>>
                <a href="<?php echo url('node/' . key(array_slice( $model['issues'], -1, 1, TRUE ))); ?>">
                    <?php print theme('imagecache', 'product_list', $model['product']['path']); ?>
                </a>
                <h4><?php echo $model['product']['title'] ?></h4>
                <?php foreach ($model['issues'] as $nid => $issue) : ?>
                    <h4><a href="<?php echo url('node/' . $nid); ?>"><?php echo $issue['num'] . ' issues - $' . $issue['price'] ?></a></h4>
                <?php endforeach ?>
            </li>
            <?php $counter++; ?>
            <?php if ($counter % 4 == 0): ?>
                <?php
                $hiddencounter += 1;
                $counter = 0;

                print "<br class='clear' />";
                ?>
            <?php endif; ?>
            <?php
            if ($hiddencounter == 2 && $counter == 0) {
                $hiddenid = "hideMe";
                ?>
                <div class="seemore"><a href="javascript:void(0);">See More</a></div>
            <?php } ?>
        <?php endforeach ?>
        <div class="clear"></div>
    </ul>
</section>

<!-- </section> -->
